<%@taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>

<%@page pageEncoding="UTF-8"%>
<%@include file="../WEB-INF/jspf/controlesessao.jspf"%>

<c:catch var ="catchException">
           <sql:update var="update" dataSource="jdbc/dbo_MicrosoftSQLServer">          
            update Alocacoes 
                set id_sala=?
                where id_alocacao=?
            <sql:param value="${param.id_sala}"/>
            <sql:param value="${param.id_alocacao}"/>
        </sql:update>

        <sql:query var="query" dataSource="jdbc/dbo_MicrosoftSQLServer">
            select situacao from alocacoes
                where id_alocacao=?
            <sql:param value="${param.id_alocacao}"/>
        </sql:query>
        <c:forEach var="row" items="${query.rows}">
            <c:if test="${empty row.situacao}">
                <p>OK</p>
            </c:if>
            <p>${row.situacao}</p>
        </c:forEach>


</c:catch>
<c:if test = "${catchException!=null}">
    Erro : Não foi possível realizar a alteração.<br><br>
    <p  style="color:red">${fn:substringAfter(catchException,"BD:")}</p>
</c:if>

